import Vue from 'vue'
import Router from 'vue-router'
import HomePage from '@/page/HomePage/HomePage'
import MemberCenter from '@/page/MemberCenter/MemberCenter'
import PageTransition from '@/page/PageTransition'
import ScoreRecord from '@/page/MemberCenter/ScoreRecord'
import SignDaily from '@/page/MemberCenter/SignDaily'
import Setting from '@/page/MemberCenter/Setting/Setting'
import UserInfo from '@/page/MemberCenter/Setting/UserInfo'
import UserAccountUpdate from '@/page/MemberCenter/Setting/UserAccountUpdate'
import NickNameUpdate from '@/page/MemberCenter/Setting/NickNameUpdate'
import ActualNameUpdate from '@/page/MemberCenter/Setting/ActualNameUpdate'
import IdCardNoUpdate from '@/page/MemberCenter/Setting/IdCardNoUpdate'
import EmailUpdate from '@/page/MemberCenter/Setting/EmailUpdate'
import Coupon from '@/page/MemberCenter/Coupon'
import MyCard from '@/page/MemberCenter/MyCard'
import MyMessage from '@/page/MemberCenter/MyMessage'
import MyOrder from '@/page/MemberCenter/MyOrder'
import tripConsultant from '@/page/MemberCenter/tripConsultant'
import HobbyUpdate from '@/page/MemberCenter/Setting/HobbyUpdate'
import tripConsultantBind from '@/page/MemberCenter/tripConsultantBind'
import MyCollection from '@/page/MemberCenter/MyCollection'

Vue.use(Router)
var router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'PageTransition',
      component: PageTransition,
      children: [
        {
          path: '/',
          component: HomePage,
          meta: {
            title: '广之旅无线官网-好评率99%,旅游特卖,品质保障!'
          }
        },
        {
          path: '/membercenter',
          component: MemberCenter,
          meta: {
            title: '易起行-会员中心'
          }
        },
        {
          path: '/signdaily',
          component: SignDaily,
          meta: {
            title: '易起行-会员签到'
          }
        },
        {
          path: '/scorerecord',
          component: ScoreRecord,
          meta: {
            title: '易起行-我的积分'
          }
        },
        {
          path: '/setting',
          component: Setting,
          meta: {
            title: '易起行-设置'
          }
        },
        {
          path: '/setting/userInfo',
          component: UserInfo,
          meta: {
            title: '用户资料'
          }
        },
        {
          path: '/setting/userInfo/userAccountUpdate/:userAccount',
          component: UserAccountUpdate,
          meta: {
            title: '用户账号修改'
          }
        },
        {
          path: '/setting/userInfo/nickNameUpdate/:nickName',
          component: NickNameUpdate,
          meta: {
            title: '用户昵称修改'
          }
        },
        {
          path: '/setting/userInfo/actualNameUpdate/:surName/:userName',
          component: ActualNameUpdate,
          meta: {
            title: '真实姓名修改'
          }
        },
        {
          path: '/setting/userInfo/idCardNoUpdate/:idCardNo',
          component: IdCardNoUpdate,
          meta: {
            title: '身份证号修改'
          }
        },
        {
          path: '/setting/userInfo/EmailUpdate/:email',
          component: EmailUpdate,
          meta: {
            title: '邮箱修改'
          }
        },
        {
          path: '/setting/userInfo/HobbyUpdate',
          component: HobbyUpdate,
          meta: {
            title: '旅游偏好'
          }
        },
        {
          path: '/mycoupon',
          component: Coupon,
          meta: {
            title: '易起行-我的优惠券'
          }
        },
        {
          path: '/mycard',
          component: MyCard,
          meta: {
            title: '易起行-我的自游通卡'
          }
        },
        {
          path: '/MyMessage',
          component: MyMessage,
          meta: {
            title: '易起行-我的消息'
          }
        },
        {
          path: '/MyOrder',
          component: MyOrder,
          meta: {
            title: '易起行-我的订单'
          }
        },
        {
          path: '/tripConsultant/:recommendCode',
          component: tripConsultant,
          meta: {
            title: '易起行-专属旅游顾问'
          }
        },
        {
          path: '/MyCollection',
          component: MyCollection,
          meta: {
            title: '易起行-我的收藏'
          }
        },
        {
          path: '/tripConsultantBind',
          component: tripConsultantBind
        }
      ]
    }
  ]
})

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

export default router
